/* Copyright (C) 2011 clueless <clueless.mmopeon@gmail.com>
 *
 * This file is part of MMO Peon.
 *
 * MMO Peon is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MMO Peon is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MMO Peon.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __MMOPEON_HOOKS_H
#define __MMOPEON_HOOKS_H

#include <cstdint>

struct DirectInputMouseState
{
    uint32_t    x;
    uint32_t    y;
    uint32_t    z;
    uint8_t     button1;
    uint8_t     button2;
    uint8_t     button3;
    uint8_t     button4;
}__attribute__((packed));

// Location of the hooks and their original bytes
const uintptr_t sendHookAddress     = 0x006DC530;
const uint8_t   sendHookOriginal[]  = "\x8B\x44\x24\x04\x83";
const uintptr_t recvHookAddress     = 0x006DBD44;
const uint8_t   recvHookOriginal[]  = "\x8B\x44\x24\x28\x0F";
const uintptr_t diHookAddress       = 0x00471258;
const uint8_t   diHookOriginal[]    = "\x57\x53\x50\xFF\xD2";
const uintptr_t mouseJumpAddress    = 0x0061D698;
const uint8_t   mouseJumpOriginal[] = "\x0F\x84\x99\x00\x00\x00";

void InstallHooks();
void RemoveHooks();

extern void *SendHookStub;
extern void *RecvHookStub;
extern void *DirectInputHookStub;
#endif
